package org.csmzxy.class2333;

public class 作业1 {
    public static void main(String[] args) {
        int arr[] = {1, 3, 5, 7};
        int maxvalue = findMax(arr);
        System.out.println("数组中的最大值是：" + maxvalue);

    }

    public static int findMax(int[] arr) {

        if (arr == null || arr.length == 0) {
            throw new IllegalArgumentException("数组不能为空");
        }

        int max = arr[0];
        for (int i = 1; i < arr.length; i++) {

            if (arr[i] > max) {
                max = arr[i];
            }
        }
        return max;
    }
}